<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <!-- 引入bootstarp -->
    <script type="text/javascript" src="../js/bootstrap3/js/bootstrap.js"></script>
    <link rel="stylesheet" href="../js/bootstrap3/css/bootstrap.css">
    <!-- 引入bootstrap table的css、js -->
    <link type="text/css" rel="stylesheet" href="../js/bootstrap-table/bootstrap-table.css">
    <script type="text/javascript" src="../js/bootstrap-table/bootstrap-table.js"></script>
    <script type="text/javascript" src="../js/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
    <!-- 引入bootstrap datetime的css、js -->
    <link type="text/css" rel="stylesheet" href="../js/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css">
    <script type="text/javascript" src="../js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript" src="../js/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
</head>
<body>
<form class="form-inline">
    <div class="form-group">
        <label for="startPrice">
            <font color="red">时间</font>
        </label>
        <input type="text" class="date form-control" id="startPrice" placeholder="请输入开始时间">
        <i class="glyphicon glyphicon-calendar"></i>
        <input type="text" class="date form-control" id="endPrice" placeholder="请输入结束时间">
    </div>
    <button type="button" class="btn btn-primary glyphicon glyphicon-search" onclick="shopTable()">搜索</button>

</form>
<table class="table" id="shopTable"></table>
</body>
<script>
    $(function () {
        tables();
    })
    /**
     * 初始化页面加载所有订单信息
     */
    function tables(){
        $("#shopTable").bootstrapTable({
            url:'../zsl/findOrder',
            type:'post',
            pagination:true, //开启分页
            //pageList:[1, 5, 10, 15,50],//分页组件
            pageNumber:1,
            pageSize:10,//默认每页条数
            sidePagination:'server',//分页方式：client客户端分页，server服务端分页
            striped:true,//条纹表格
            clickToSelect: true,
            queryParams:function(){
                return {
                    id:3,
                    page:this.pageNumber,
                    rows:this.pageSize,
                    startDate:$("#startTime").val(),
                    endDate:$("#endTime").val()
                };
            },
            columns:[
                {checkbox:true},
                {field:'orderNo',title:'订单编号',width:80},
                {field:'userName',title:'用户昵称',width:80},
                {field:'userImg',title:'用户头像',width:80,formatter:function(value,row,index){
                        return "<img src='"+value+"' width='50px' height='50px'/>";
                    }},
                {field:'orderPrice',title:'订单总价',width:80},
                {field:'productName',title:'购买商品',width:80},
                {field:'orderCreateTime',title:'订单生成时间',width:80},
                {field:'productCount',title:'商品数量',width:80},
                {field:'orderStatus',title:'订单状态',width:80,formatter:function (value) {
                    if (value == 1){
                        return "未付款"
                    }
                    if (value == 2){
                        return "已付款"
                    }
                        if (value == 3){
                            return "订单取消"
                        }
                    }}
            ],
        })
    }

    function searchUserShop() {
        $("#userShopTable").bootstrapTable('refresh');
    }
</script>
</html>